package com.gsafety.libraryktx.util

import android.content.Context

import com.bumptech.glide.GlideBuilder
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory
import com.bumptech.glide.load.engine.cache.LruResourceCache
import com.bumptech.glide.module.AppGlideModule

@GlideModule
class MGlideModule : AppGlideModule() {
    override fun applyOptions(context: Context, builder: GlideBuilder) {
        //图片质量
        //builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
        //SD卡缓存
        builder.setDiskCache(
                InternalCacheDiskCacheFactory(context, (50 * 1024 * 1024).toLong()))
        //内存缓存
        builder.setMemoryCache(LruResourceCache((20 * 1024 * 1024).toLong()))
    }
}
